<?php

/**
 * Description of RegisterForm
 *
 * @author Adrián Gallardo
 */
class RegisterForm extends BaseContainerForm {

    private $user_form;
    private $company_form;
    private $social_media_selector_form;

    /**
     * Form Configuration
     * Embed form and model relations
     */
    public function configure(){

        $user_form = new UserForm();
        $company_form = new CompanyForm();
        $social_media_selector_form = new SocialMediaSelectorForm(array(), array('user' => $user_form->getObject(), 'name' => 'social_media_selector'));

        $user_form->offsetUnset('company_id');

        $company = $company_form->getObject();
        $user_form->getObject()->setCompany($company);
        $social_media_selector_form->setUser($user_form->getObject());

        $this->embedForm($company_form->getName(), $company_form);
        $this->embedForm($user_form->getName(), $user_form);
        $this->embedForm($social_media_selector_form->getName(), $social_media_selector_form);

        $this->user_form = $user_form;
        $this->company_form =  $company_form;
        $this->social_media_selector_form =  $social_media_selector_form;

    }

    public function getUserForm(){
        return $this->user_form;
    }

    public function getCompanyForm(){
        return $this->company_form;
    }

    public function getSocialMediaForms(){
        return $this->social_media_selector_form->getEmbeddedForms();
    }

    
}
?>
